import {BasicApi} from "@/common/BasicApi.ts";
import Result from "@/common/Result.ts";
import PageVo from "@/common/PageVo.ts";
import SelectVo from "@/common/SelectVo.ts";
import axiosRequest from "@/config/axios.ts";
import {FileBo, FileSearchBo, FileVo} from "@/dto/file/File.ts";

class FileApi implements BasicApi<FileVo, FileBo, FileSearchBo>{
    async listAll(sb: FileSearchBo): Promise<Result<Array<FileVo>>> {
        return await axiosRequest.post("/file/list_all",sb);
    }

    async deleted(sb: FileSearchBo): Promise<Result<FileVo>> {
        return await axiosRequest.post("/file/deleted",sb);
    }

    async deletedAll(sbList: Array<FileSearchBo>): Promise<Result<Array<FileVo>>> {
        return await axiosRequest.post("/file/deleted_all",sbList);
    }

    async edit(b: FileBo): Promise<Result<FileVo>> {
        return await axiosRequest.post("/file/edit",b);
    }

    async editAll(bList: Array<FileBo>): Promise<Result<Array<FileVo>>> {
        return await axiosRequest.post("/file/edit_all",bList);
    }

    async get(sb: FileSearchBo): Promise<Result<FileVo>> {
        return await axiosRequest.post("/file/get",sb);
    }
    async getId(id: number): Promise<Result<FileVo>> {
        return await axiosRequest.get(`/file/get/${id}`);
    }

    async option(): Promise<Result<Array<SelectVo<string, number, FileVo>>>> {
        return await axiosRequest.post("/file/option");
    }

    async pageAll(sb: FileSearchBo): Promise<Result<PageVo<FileVo>>> {
        return await axiosRequest.post("/file/page_all",sb);
    }

    async upload(form:FormData):Promise<Result<FileVo>>{
        return await axiosRequest.post<FormData,Result<FileVo>>("/file/upload",form)
    }

    // async download(){
    // }
    //
    // async downloadId(){
    // }

}

export default FileApi